package fun.pengzh.sssdnsy.config;

import fun.sssdnsy.client.spring.ConfigFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Desc
 * @Author pengzh
 * @Since 2023-03-31
 */
@Configuration
public class ConfConfig {

    private Logger logger = LoggerFactory.getLogger(ConfConfig.class);


    @Value("${melon.conf.admin.address}")
    private String adminAddress;

    @Value("${melon.conf.env}")
    private String env;

    @Value("${melon.conf.access.token}")
    private String accessToken;

    @Value("${melon.conf.mirrorfile}")
    private String mirrorFile;


    @Bean
    public ConfigFactory xxlConfFactory() {

        ConfigFactory xxlConf = new ConfigFactory();
        xxlConf.setAdminAddress(adminAddress);
        xxlConf.setEnv(env);
        xxlConf.setAccessToken(accessToken);
        xxlConf.setMirrorFile(mirrorFile);

        logger.info(">>>>>>>>>>> melon-conf config init.");
        return xxlConf;
    }
}
